home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-02-04 | 46.8 KB | 1,874 lines |
- *** 1.63 1992/01/14 18:46:50
- --- Changelo 1992/02/04 17:15:53
- ***************
- *** 2620,2622 ****
- --- 2620,2786 ----
- the next's. make adjustments to unlink_handler.
-
- ---------------------------- Patchlevel 74 ---------------------------
- +
- + scanf.c:: Michael Ritzert
- + - incorrect return value if fewer data items than specified
- + could be read: the supplied _scanf always returns -1 in this case.
- + Instead, it should return EOF if the error occured before
- + the first data item to be read and the number of items
- + read with success later on.
- + - the %c format passes the character following the one to be read.
- +
- + fscanf.c:: ++jrb
- + #define fungetc to ungetc for pre Ansi sunOS 4.0.*
- +
- + ctype.[ch]:: andreas
- + allow negative characters (also handles 0xff correctly)
- +
- + fopen/fdopen:: andreas
- + set errno to EMFILE if there are no more FILE slots free
- + (gawk uses it)
- +
- + fputc:: andreas
- + don't return EOF if c == (signed char)0xff
- +
- + malloc.c:: andreas
- + split memory didn't work
- + the memory allocation routines if using the split memory
- + model, sbrk can return values which are out of order, due to switching
- + from system heap to own heap.
- +
- + lstat:: andreas
- + unx2dos already stored the link flags in __link_flags; no
- + need to call unx2dos twice
- +
- + system:: andreas
- + command line argument can be arbitrary long, hope no longer
- + than BUFSIZ
- +
- + unx2dos:: andreas
- + the link contents can be a full pathname in symbolic links
- +
- + write.c:: andreas
- + handle chars with high bit set correctly
- +
- + fcntl.h:: andreas
- + GEMDOS returns file handles <= 80 (for TOS 1.4, don't know
- + about newer TOS's)
- +
- + main.c:: andreas
- + indices into __open_stat were mixed with file handles.
- +
- + system.c:: frank
- + skip over quotes.
- +
- + pwd.h, getpw.c:: frank, ++jrb
- + adjust types for uid and gid. they should be uid_t and gid_t
- + respectively.
- +
- + pipe.c:: ++jrb
- + cleanup: get rid of -Wall warnings.
- +
- + localtim.c:: ++jrb
- + if the time given is weird, return the epoch. this is a questionable
- + fix: we used to return NULL, but that seems to cause problems, as things
- + that use the pointer returned by localtime() never seem to check for
- + the possibility of a NULL. my handy ANSI reference is mum on what to
- + do when the time given is weird. this was causing zoo to blow up in
- + zoosrc/nixtime.i when trying to archive files with weird timestamps (some
- + people seem to have a weird kbd processor that time warps!).
- +
- + ostruct.h:: Bill Shroka
- + NEW file. it contains most of the popular OS (non Aes/Vdi) structures
- + Thanks bill: this is a good beginning to this file, it more or
- + less corresponds to franks Documentation/varcard.tex. We can add
- + on more stuff as needed.
- +
- + osbind.h:: Bill Shroka
- + use <ostruct.h>
- +
- + pipe.c:: ++jrb
- + All fprintf() in here needed to be conditional upon DEBUG. Thanks
- + to michal for finding this. his code was unexpectedly pulling in all
- + kinds of stuff due to external references tp fprintf() here.
- +
- + pipe.c, close.c:: ++jrb
- + take out direct call to pipeclose() from close to avoid pulling
- + in all the pipe stuff into programs that dont use pipes. instead
- + go thru a pointer that is initially nulled, and if the program calles
- + pipe() is patched in with the address of pipeclose(). this way only the code
- + that actually uses pipes will link in the pipe code.
- +
- + crt0.c:: ++jrb
- + cleanup.
- +
- + float.h: mjr
- + cleanup values to better reflect reality.
- +
- +
- + ***** NOTE ***** ***** NOTE ***** ***** NOTE ***** ***** NOTE *****
- +
- + _addsubd.s _addsubs.s _divdf3.s _divsf3.s _extends.s _fixdfsi.s _fxunsd.s
- + _floatsi.s _muldf3.s _mulsf3.s _normdf.s _normsf.s _truncdf.s modf.s:: mjr
- +
- + NOTE: these .S files replaced with corresponding .CPP files.
- +
- +
- + mincl:: ++jrb
- + adjust targets for above
- +
- + math-68881.h:: ++mjr
- + removed any error checking code (use the library versions if
- + error checking is required)
- +
- + frexp:: ++mjr
- + y = frexp(0,ip) now corectly returns 0 both in y and *ip
- +
- + sfp004 - version written but not tested due to lack of hardware
- + my sfp004 board died, so only a "plausibility test" could be made.
- + most probable sources of bugs:
- + the fscale instruction has been inserted to the old function body
- + after the dead of the board.
- + The test if the 1st arg is 0, too.
- +
- + doprnt.c:: ++mjr
- + NAN and INFINITY conditions are caught by analysing only the most
- + significant long word (uniqe).
- + this also serves as a workaround to the conversion bug of
- + gcc-as
- + (DBL_MAX is converted to 0x7ff00000 0x00000002
- + instead of 0x7fefffff 0xfffffffe
- + ) which sometimes causes doprnt to crash.
- +
- + _fixdfsi.cpp:
- + _fixunsdfsi.cpp:
- + optional error checking added.
- + All three situations (no fpu, sfp004, TT) supported.
- +
- + _normsf.cpp:
- + _divdf3.cpp:
- + _divsf3.cpp:
- + returns signed infinity in case of an exception.
- + if option ERROR_CHECK is enabled:
- + _errno is set to ERANGE.
- + The EDOM situation 0/0 is not tested explicitly.
- + All three situations (no fpu, sfp004, TT) supported.
- +
- + _normdf.cpp:
- + if option ERROR_CHECK is enabled:
- + _errno is set to ERANGE.
- + message is printed.
- + value of ERANGE corrected to 62 (was 34 = EPATH)
- +
- + ldexp.cpp:
- + value of ERANGE corrected to 62 (was 34 = EPATH)
- + optional ERROR_CHECK inserted.
- + underflow is no longer considered an error condition to
- + stay consistent with pml.
- + if ERROR_CHECK is enabled, a message is printed on overflow.
- +
- + _addsubd.cpp:
- + _addsubs.cpp:
- + _muldf3.cpp:
- + _mulsf3.cpp: ++mjr:
- + sfp004 code and software floating point code merged into one file.
- +
- + ---------------------------- Patchlevel 75 ---------------------------
- *** 1.50 1991/12/26 15:53:59
- --- PatchLev.h 1992/02/04 17:15:54
- ***************
- *** 1,5 ****
-
- ! #define PatchLevel "74"
-
- /*
- *
- --- 1,5 ----
-
- ! #define PatchLevel "75"
-
- /*
- *
- *** 1.19 1991/12/26 15:53:59
- --- atof.c 1992/02/04 17:16:01
- ***************
- *** 27,34 ****
- * the old naive coding is at the end bracketed by ifdef __OLD__.
- * modeled after peter housels posting on comp.os.minix.
- * thanks peter!
- ! * ++jrb
- */
- #if !(defined(unix) || defined(minix))
- #include <stddef.h>
- #include <stdlib.h>
- --- 27,38 ----
- * the old naive coding is at the end bracketed by ifdef __OLD__.
- * modeled after peter housels posting on comp.os.minix.
- * thanks peter!
- ! *
- ! * mjr: 68881 version added
- */
- +
- + #if !defined (__M68881__) && !defined (sfp004)
- +
- #if !(defined(unix) || defined(minix))
- #include <stddef.h>
- #include <stdlib.h>
- ***************
- *** 240,246 ****
- register short e = 0;
- double zero = 0.0;
- const char *tmp;
- !
- assert ((s != NULL));
-
- if(endptr != NULL) *endptr = (char *)s;
- --- 244,250 ----
- register short e = 0;
- double zero = 0.0;
- const char *tmp;
- !
- assert ((s != NULL));
-
- if(endptr != NULL) *endptr = (char *)s;
- ***************
- *** 281,287 ****
- {
- if(*++s != '\0') /* skip e|E|d|D */
- { /* ! ([s]xxx[.[yyy]]e) */
- ! tmp = s;
- while(Isspace(*s)) s++; /* Ansi allows spaces after e */
- if(*s != '\0')
- { /* ! ([s]xxx[.[yyy]]e[space]) */
- --- 285,291 ----
- {
- if(*++s != '\0') /* skip e|E|d|D */
- { /* ! ([s]xxx[.[yyy]]e) */
- ! tmp = s;
- while(Isspace(*s)) s++; /* Ansi allows spaces after e */
- if(*s != '\0')
- { /* ! ([s]xxx[.[yyy]]e[space]) */
- ***************
- *** 324,453 ****
- return strtod(s, (char **)NULL);
- }
-
- - #ifdef TEST
- - #ifdef __MSHORT__
- - #error "please run this test in 32 bit int mode"
- - #endif
- -
- - #define NTEST 10000L
- -
- - #ifdef unix
- - #ifdef __MSHORT__
- - #define RAND_MAX (0x7FFF) /* maximum value from rand() */
- - #else
- - #define RAND_MAX (0x7FFFFFFFL) /* maximum value from rand() */
- - #endif
- - #endif
- -
- - main()
- - {
- -
- - double expected, result, e, max_abs_err;
- - char buf[128];
- - register long i, errs;
- - register int s;
- - #ifdef __STDC__
- - double atof(const char *);
- - int rand(void);
- - #else
- - extern double atof();
- - extern int rand();
- - #endif
- -
- - #if 0
- - expected = atof("3.14159265358979e23");
- - expected = atof("3.141");
- - expected = atof(".31415");
- - printf("%f\n\n", expected);
- - expected = atof("3.1415");
- - printf("%f\n\n", expected);
- - expected = atof("31.415");
- - printf("%f\n\n", expected);
- - expected = atof("314.15");
- - printf("%f\n\n", expected);
- -
- - expected = atof(".31415");
- - printf("%f\n\n", expected);
- - expected = atof(".031415");
- - printf("%f\n\n", expected);
- - expected = atof(".0031415");
- - printf("%f\n\n", expected);
- - expected = atof(".00031415");
- - printf("%f\n\n", expected);
- - expected = atof(".000031415");
- - printf("%f\n\n", expected);
- -
- - expected = atof("-3.1415e-9");
- - printf("%20.15e\n\n", expected);
- -
- - expected = atof("+3.1415e+009");
- - printf("%20.15e\n\n", expected);
- - #endif
- -
- - expected = atof("+3.123456789123456789");
- - printf("%30.25e\n\n", expected);
- -
- - expected = atof(".000003123456789123456789");
- - printf("%30.25e\n\n", expected);
- -
- - expected = atof("3.1234567891234567890000000000");
- - printf("%30.25e\n\n", expected);
- -
- - expected = atof("9.22337999999999999999999999999999999999999999");
- - printf("%47.45e\n\n", expected);
- -
- - expected = atof("1.0000000000000000000");
- - printf("%25.19e\n\n", expected);
- -
- - expected = atof("1.00000000000000000000");
- - printf("%26.20e\n\n", expected);
- -
- - expected = atof("1.000000000000000000000");
- - printf("%27.21e\n\n", expected);
- -
- - expected = atof("1.000000000000000000000000");
- - printf("%30.24e\n\n", expected);
- -
- -
- - #if 0
- - expected = atof("1.7e+308");
- - if(errno != 0)
- - {
- - printf("%d\n", errno);
- - }
- - else printf("1.7e308 OK %g\n", expected);
- - expected = atof("1.797693e308"); /* anything gt looses */
- - if(errno != 0)
- - {
- - printf("%d\n", errno);
- - }
- - else printf("Max OK %g\n", expected);
- - expected = atof("2.225073858507201E-307");
- - if(errno != 0)
- - {
- - printf("%d\n", errno, expected);
- - }
- - else printf("Min OK %g\n", expected);
- - #endif
- -
- - max_abs_err = 0.0;
- - for(errs = 0, i = 0; i < NTEST; i++)
- - {
- - expected = (double)(s = rand()) / (double)rand();
- - if(s > (RAND_MAX >> 1)) expected = -expected;
- - sprintf(buf, "%.14e", expected);
- - result = atof(buf);
- - e = (expected == 0.0) ? result : (result - expected)/expected;
- - if(e < 0) e = (-e);
- - if(e > 1.0e-6)
- - {
- - errs++; printf("%.14e %s %.14e (%.14e)\n", expected, buf, result, e);
- - }
- - if (e > max_abs_err) max_abs_err = e;
- - }
- - printf("%ld Error(s), Max abs err %.14e\n", errs, max_abs_err);
- - }
- - #endif /* TEST */
-
- /* old naive coding */
- #ifdef __OLD__
- --- 328,333 ----
- ***************
- *** 567,569 ****
- --- 447,847 ----
- return r;
- }
- #endif /* __OLD__ */
- +
- + #else __M68881__ || sfp004
- +
- + #if 0
- + #ifndef sfp004
- + # define _M68881 /* use the predefined inline functions */
- + #endif sfp004
- + #endif 0
- +
- + /* M.R's kludgy atof --- 881 version. */
- + /* uses long integer accumulators and extended precision to put them */
- + /* together in the fpu. The conversion long to extended is done completely */
- + /* on the 881. */
- + /* using extended precision in _float_ avoids rounding errors. */
- +
- + /* 12.7.1989, 11.10.90, 28.1.91, 24.11.91 */
- + /* On overflow, only +-infinity is returned (the 68881's default). */
- + /* 24.11.91: return +-MAXDOUBLE instead of +- INFINITY or NAN */
- + /* set errno to ERANGE/EDOM */
- +
- + # include <ctype.h>
- + # include <stdio.h>
- + # include <float.h>
- + # include <math.h>
- + # include <errno.h>
- + # include "flonum.h"
- +
- + double atof( const char * );
- + double strtod( const char *, const char ** );
- + double _Float_( long, long, long, long );
- +
- + # define true 1
- + # define false 0
- + # define CharIsDigit ( isdigit(*Text) )
- + # define Digit ((*Text-'0'))
- +
- + #if 0
- + static unsigned long
- + __notanumber[2] = { 0x7fffffffL, 0xffffffffL }; /* ieee NAN */
- + # define NAN (*((double *)&__notanumber[0]))
- + # endif 0
- +
- + # define ten_mul(X) ((((X) << 2) + (X)) << 1)
- +
- + double strtod( const char * Save, const char ** Endptr )
- + {
- + register int Count; int Negative = false, ExpNegative = false;
- +
- + double Value;
- + union double_di * l_Value;
- + register long Exponent, Exp_Temp;
- + register long Value_1, Value_2;
- + register char c;
- + register char * Text;
- + register char * Places;
- + char Buffer[15];
- +
- + l_Value = (union double_di *) &Value;
- +
- + Text = Save;
- + Places = Buffer;
- +
- + /* skip over leading whitespace */
- + while (isspace(*Text)) Text++;
- +
- + if (*Text == '-') {
- + Negative = true;
- + Text++;
- + } else
- + if (*Text == '+') {
- + Negative = false;
- + Text++;
- + } else
- + if( *Text == 0 ) {
- + if( Endptr != NULL ) *Endptr = Text;
- + return 0.0;
- + }
- +
- + /* Process the 'f'-part */
- + /* ignore any digit beyond the 15th */
- + /* BUG: may overflow if more than 10 digits precede the '.' */
- + /* to cure use to accumulators as is being done for the digits after */
- + /* the '.'. */
- +
- + Exp_Temp = 0; /* needed later on for the exponential part */
- + Value_1 = 0; Value_2 = 0; Count = 0; Exponent = 0;
- + while( CharIsDigit ) { /* process digits before '.' */
- + if( Count < 15 ) {
- + Count++;
- + *Places++ = Digit;
- + }
- + Text++;
- + }
- + if ( *Text == '.') {
- + Text++;
- + while( CharIsDigit ) { /* process digits after '.' */
- + if( Count < 15 ) {
- + Count++;
- + *Places++ = Digit;
- + Exponent--;
- + }
- + Text++;
- + }
- + }
- + Places = Buffer;
- +
- + /* Now, Places points to a vector of <= 15 digits */
- + /* text points to the position immediately after the end of the mantissa */
- + /* Value_2 will contain the equiv. of the 8 least significant digits, while */
- + /* Value_1 will contain the equiv. of the 7 most significant digits (if any) */
- + /* and therefore has to be multiplied by 10^8 */
- + /* no overflow possible in the temporary buffers */
- +
- + while( Count > 8 ) {
- + Value_1 = ten_mul( Value_1 ); Value_1 += *Places++;
- + Count--;
- + }
- + while( Count > 0 ) {
- + Value_2 = ten_mul( Value_2 ); Value_2 += *Places++;
- + Count--;
- + }
- +
- + /* 'e'-Part */
- + if ( *Text == 'e' || *Text == 'E' || *Text == 'd' || *Text == 'D' ) {
- +
- + char * Tail = Text;
- + Text++;
- +
- + /* skip over whitespace since ANSI allows space after e|E|d|D */
- + while (isspace(*Text)) Text++;
- +
- + if ( * Text == '-' ) {
- + ExpNegative = true;
- + Text++;
- + } else
- + if( * Text == '+' ) {
- + ExpNegative = false;
- + Text++;
- + }
- + if( !CharIsDigit ) {
- + *Endptr = Tail; /* take the 'e|E|d|D' as part of the characters */
- + goto Ende; /* following the number */
- + } else {
- + /* Exponents may have at most 3 digits, everything beyond this will be */
- + /* silently ignored */
- + Count = 0;
- + while( CharIsDigit && (Count < 3) ) {
- + Exp_Temp = ten_mul( Exp_Temp ); Exp_Temp += Digit;
- + Count++;
- + Text++;
- + }
- + if( ExpNegative ) Exp_Temp = -Exp_Temp;
- + Exponent += Exp_Temp;
- + }
- + }
- + Value = _Float_( Value_1, Exponent+8L, Value_2, Exponent );
- +
- + if( Endptr != NULL ) *Endptr = Text;
- + if( (l_Value -> i[0]) >= 0x7ff00000U ) { /* INFINITY or NAN */
- + fprintf(stderr," strtod: OVERFLOW error\n");
- + errno = ERANGE;
- + Value = DBL_MAX;
- + }
- +
- + Ende:
- + if( Negative ) {
- + Value = -Value;
- + }
- + return( Value );
- +
- + # if 0
- + Error:
- + fputs("\njunk number \"",stderr); fputs(Save,stderr);
- + fputs("\" --- returning NAN\n",stderr);
- + errno = ERANGE;
- + if( Endptr != NULL ) *Endptr = Text;
- + return(NAN); /* == Not A Number (NAN) */
- + # endif
- + }
- +
- + double atof( const char * Text )
- + {
- + return(strtod(Text,(char **)NULL));
- + }
- +
- + /*
- + * double _Float_( long Value_1, long Exponent_1, long Value_2, long Exponent_2 )
- + *
- + * merges the accumulators Value_1, Value_2 and the Exponent to a double
- + * precision float
- + * called by strtod()
- + *
- + * does all floating point computations with extended precision on the fpu
- + */
- +
- + #endif __M68881__ || sfp004
- +
- + #ifdef __M68881__
- + asm(
- + ".even
- + .text
- + .globl __Float_
- + __Float_:
- + ftentoxl a7@(8),fp1 | load Exponent_1
- + ftentoxl a7@(16),fp2 | load Exponent_2
- + fmull a7@(12),fp2 | fmull Value_2 -> fp2
- + fmull a7@(4),fp1 | fmull Value_1 -> fp1
- + faddx fp2,fp1
- + fmoved fp1,a7@- | fmoved fp1 -> d0/d1
- + moveml a7@+,d0-d1
- + rts
- + ");
- + #endif __M68881
- + #ifdef sfp004
- +
- + asm("| mjr, 30.1.1991
- + |
- + | base = 0xfffa50
- + | the fpu addresses are taken relativ to 'base':
- + |
- + | a0: fpu base address
- + |
- +
- + | waiting loop ...
- + |
- + | wait:
- + | ww: cmpiw #0x8900,a0@(resp)
- + | beq ww
- + | is coded directly by
- + | .long 0x0c688900, 0xfff067f8 (a0)
- + | and
- + | www: tst.w a0@(resp)
- + | bmi.b www
- + | is coded by
- + | .word 0x4a68,0xfff0,0x6bfa | test
- + |
- +
- + comm = -6
- + resp = -16
- + zahl = 0
- +
- + .globl __Float_
- + .even
- + .text
- + __Float_:
- + lea 0xfffa50,a0 | fpu address
- +
- + movew #0x4092,a0@(comm) | ftentoxl -> fp1
- + .long 0x0c688900, 0xfff067f8
- + movel a7@(8),a0@ | load Exponent_1
- +
- + movew #0x4112,a0@(comm) | ftentoxl -> fp2
- + .long 0x0c688900, 0xfff067f8
- + movel a7@(16),a0@ | load Exponent_2
- +
- + movew #0x4123,a0@(comm) | fmull Value_2 -> fp2
- + .long 0x0c688900, 0xfff067f8
- + movel a7@(12),a0@ | load Value_2
- +
- + movew #0x40a3,a0@(comm) | fmull Value_1 -> fp1
- + .long 0x0c688900, 0xfff067f8
- + movel a7@(4),a0@ | load Value_1
- +
- + movew #0x08a2,a0@(comm) | faddx fp2 -> fp1
- + .word 0x4a68,0xfff0,0x6bfa | test
- +
- + movew #0x7480,a0@(comm) | fmoved fp1 -> d0/d1
- + .long 0x0c688900, 0xfff067f8
- + movel a0@,d0
- + movel a0@,d1
- + rts
- + ");
- + #endif sfp004
- +
- + #ifdef TEST
- + #if 0
- + #ifdef __MSHORT__
- + #error "please run this test in 32 bit int mode"
- + #endif
- + #endif
- +
- + #define NTEST 10000L
- +
- + #ifdef __MSHORT__
- + # define RAND_MAX (0x7FFF) /* maximum value from rand() */
- + #else
- + # define RAND_MAX (0x7FFFFFFFL) /* maximum value from rand() */
- + #endif
- +
- + main()
- + {
- +
- + double expected, result, e, max_abs_err;
- + char buf[128];
- + register long i, errs;
- + register long s;
- + #ifdef __STDC__
- + double atof(const char *);
- + int rand(void);
- + #else
- + extern double atof();
- + extern int rand();
- + #endif
- +
- + #if 0
- + expected = atof("3.14159265358979e23");
- + expected = atof("3.141");
- + expected = atof(".31415");
- + printf("%f\n\n", expected);
- + expected = atof("3.1415");
- + printf("%f\n\n", expected);
- + expected = atof("31.415");
- + printf("%f\n\n", expected);
- + expected = atof("314.15");
- + printf("%f\n\n", expected);
- +
- + expected = atof(".31415");
- + printf("%f\n\n", expected);
- + expected = atof(".031415");
- + printf("%f\n\n", expected);
- + expected = atof(".0031415");
- + printf("%f\n\n", expected);
- + expected = atof(".00031415");
- + printf("%f\n\n", expected);
- + expected = atof(".000031415");
- + printf("%f\n\n", expected);
- +
- + expected = atof("-3.1415e-9");
- + printf("%20.15e\n\n", expected);
- +
- + expected = atof("+3.1415e+009");
- + printf("%20.15e\n\n", expected);
- + #endif
- +
- + expected = atof("+3.123456789123456789");
- + printf("%30.25e\n\n", expected);
- +
- + expected = atof(".000003123456789123456789");
- + printf("%30.25e\n\n", expected);
- +
- + expected = atof("3.1234567891234567890000000000");
- + printf("%30.25e\n\n", expected);
- +
- + expected = atof("9.22337999999999999999999999999999999999999999");
- + printf("%47.45e\n\n", expected);
- +
- + expected = atof("1.0000000000000000000");
- + printf("%25.19e\n\n", expected);
- +
- + expected = atof("1.00000000000000000000");
- + printf("%26.20e\n\n", expected);
- +
- + expected = atof("1.000000000000000000000");
- + printf("%27.21e\n\n", expected);
- +
- + expected = atof("1.000000000000000000000000");
- + printf("%30.24e\n\n", expected);
- +
- +
- + #if 0
- + expected = atof("1.7e+308");
- + if(errno != 0)
- + {
- + printf("%d\n", errno);
- + }
- + else printf("1.7e308 OK %g\n", expected);
- + expected = atof("1.797693e308"); /* anything gt looses */
- + if(errno != 0)
- + {
- + printf("%d\n", errno);
- + }
- + else printf("Max OK %g\n", expected);
- + expected = atof("2.225073858507201E-307");
- + if(errno != 0)
- + {
- + printf("%d\n", errno, expected);
- + }
- + else printf("Min OK %g\n", expected);
- + #endif
- +
- + max_abs_err = 0.0;
- + for(errs = 0, i = 0; i < NTEST; i++)
- + {
- + expected = (double)(s = rand()) / (double)rand();
- + if(s > (RAND_MAX >> 1)) expected = -expected;
- + sprintf(buf, "%.14e", expected);
- + result = atof(buf);
- + e = (expected == 0.0) ? result : (result - expected)/expected;
- + if(e < 0) e = (-e);
- + if(e > 1.0e-6)
- + {
- + errs++; printf("%.14e %s %.14e (%.14e)\n", expected, buf, result, e);
- + }
- + if (e > max_abs_err) max_abs_err = e;
- + }
- + printf("%ld Error(s), Max abs err %.14e\n", errs, max_abs_err);
- + }
- + #endif /* TEST */
- *** 1.13 1991/12/26 15:53:59
- --- close.c 1992/02/04 17:16:05
- ***************
- *** 9,15 ****
- #include <device.h>
- #include <stdlib.h>
-
- ! __EXTERN int pipeclose __PROTO((int fd));
-
- #ifdef DEBUG
- #include <stdio.h>
- --- 9,15 ----
- #include <device.h>
- #include <stdlib.h>
-
- ! int (*pipeclose_p) __PROTO((int fd)) = 0;
-
- #ifdef DEBUG
- #include <stdio.h>
- ***************
- *** 38,44 ****
- rval = close(oldfd);
- }
- else
- ! rval = pipeclose(oldfd);
- return(rval);
- }
- else
- --- 38,44 ----
- rval = close(oldfd);
- }
- else
- ! rval = (*pipeclose_p)(oldfd);
- return(rval);
- }
- else
- *** 1.18 1991/12/26 15:53:59
- --- crt0.c 1992/02/04 17:16:05
- ***************
- *** 240,246 ****
- _stksize = _initial_stack;
- }
-
- ! if((_stksize < 0) && (_stksize != -1L))
- {
- _heapbase = (void *) ((long)bp->p_tbase + m);
- _stksize = -_stksize - 1;
- --- 240,246 ----
- _stksize = _initial_stack;
- }
-
- ! if((_stksize < -1L))
- {
- _heapbase = (void *) ((long)bp->p_tbase + m);
- _stksize = -_stksize - 1;
- ***************
- *** 247,253 ****
- }
-
- if((!_initial_stack) && (_stksize >= -1L))
- ! { /* keep all, malloc from Malloc first, then from own heap */
- _split_mem = 1;
- }
-
- --- 247,253 ----
- }
-
- if((!_initial_stack) && (_stksize >= -1L))
- ! { /* malloc from Malloc first, then from own heap */
- _split_mem = 1;
- }
-
- *** 1.5 1991/03/13 14:58:25
- --- ctype.c 1992/02/04 17:16:06
- ***************
- *** 12,20 ****
- /* some code uses these as function pointers -- i */
- /* have seen code that does. */
-
- ! static unsigned char _myctype[UCHAR_MAX+2] =
- {
- - 0, /* isXXX(EOF) caught here */
- _CTc, _CTc, _CTc, _CTc, /* 0x00..0x03 */
- _CTc, _CTc, _CTc, _CTc, /* 0x04..0x07 */
- _CTc, _CTc|_CTs, _CTc|_CTs, _CTc|_CTs, /* 0x08..0x0B */
- --- 12,19 ----
- /* some code uses these as function pointers -- i */
- /* have seen code that does. */
-
- ! unsigned char _ctype[UCHAR_MAX+1] =
- {
- _CTc, _CTc, _CTc, _CTc, /* 0x00..0x03 */
- _CTc, _CTc, _CTc, _CTc, /* 0x04..0x07 */
- _CTc, _CTc|_CTs, _CTc|_CTs, _CTc|_CTs, /* 0x08..0x0B */
- ***************
- *** 64,71 ****
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xE0..0xEF */
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 /* 0xF0..0xFF */
- };
- -
- - unsigned char *_ctype = &(_myctype[1]);
-
- int toupper(c)
- int c;
- --- 63,68 ----
- *** 1.8 1991/05/23 14:43:17
- --- doprnt.c 1992/02/04 17:16:07
- ***************
- *** 18,25 ****
- --- 18,34 ----
- /*
- * minorly customized for gcc lib
- * ++jrb
- + * and for the sfp004 as well as the TT's 68881
- + * mjr++
- */
-
- + static unsigned long
- + __notanumber[2] = { 0x7fffffffL, 0xffffffffL }; /* ieee NAN */
- + #define NAN (*((double *)&__notanumber[0]))
- + static unsigned long
- + __p_infinity[2] = { 0x7ff00000L, 0x00000000L }; /* ieee NAN */
- + #define INF (*((double *)&__p_infinity[0]))
- +
- #ifdef LIBC_SCCS
- static char sccsid[] = "@(#)doprnt.c 5.37 (Berkeley) 3/26/89";
- #endif /* LIBC_SCCS */
- ***************
- *** 30,36 ****
- #include <ctype.h>
- #include <string.h>
- #include <limits.h>
- ! #include <math.h>
-
- #ifndef __GNUC__ /* gcc lib has these typedefs in sys/types.h */
- typedef unsigned char u_char;
- --- 39,45 ----
- #include <ctype.h>
- #include <string.h>
- #include <limits.h>
- ! #include <math.h> /* mjr++ */
-
- #ifndef __GNUC__ /* gcc lib has these typedefs in sys/types.h */
- typedef unsigned char u_char;
- ***************
- *** 39,47 ****
-
- /* 11-bit exponent (VAX G floating point) is 308 decimal digits */
- #define MAXEXP 308
- /* 128 bit fraction takes up 39 decimal digits; max reasonable precision */
- ! #define MAXFRACT 39
-
- #define DEFPREC 6
-
- #define BUF (MAXEXP+MAXFRACT+1) /* + decimal point */
- --- 48,62 ----
-
- /* 11-bit exponent (VAX G floating point) is 308 decimal digits */
- #define MAXEXP 308
- +
- /* 128 bit fraction takes up 39 decimal digits; max reasonable precision */
- ! # define MAXFRACT 39
- ! # define MAXEXP 308
-
- + #if defined (__M68881__) && !defined (sfp004)
- + # include <math-68881.h> /* mjr: use the inline functions */
- + #endif __M68881__
- +
- #define DEFPREC 6
-
- #define BUF (MAXEXP+MAXFRACT+1) /* + decimal point */
- ***************
- *** 71,79 ****
- #endif
-
- #ifdef __FLOATS__
- ! static char *exponent __PROTO((char *, int, int));
- ! static char *round __PROTO((double, int *, char *, char *, int, char *));
- ! static int cvt __PROTO((double, int, int, char *, int, char *, char *));
- #endif
-
- #ifdef __GNUC__
- --- 86,101 ----
- #endif
-
- #ifdef __FLOATS__
- ! # include "flonum.h"
- ! # if __STDC__
- ! static char *exponent(char *, int, int);
- ! static char *round(double, int *, char *, char *, int, char *);
- ! static int cvt(double, int, int, char *, int, char *, char *);
- ! # else
- ! static char *exponent();
- ! static char *round();
- ! static int cvt();
- ! # endif
- #endif
-
- #ifdef __GNUC__
- ***************
- *** 97,103 ****
- } \
- else \
- { \
- ! extern unsigned long __udivsi3(long, long); /* quot = d0, rem = d1 */ \
- do \
- { \
- __asm__ volatile(" \
- --- 119,125 ----
- } \
- else \
- { \
- ! extern unsigned long __udivsi3(); /* quot = d0, rem = d1 */ \
- do \
- { \
- __asm__ volatile(" \
- ***************
- *** 127,133 ****
- register int cnt; /* return value accumulator */
- register int n; /* random handy integer */
- register char *t; /* buffer pointer */
- ! double _double; /* double precision arguments %[eEfgG] */
- u_long _ulong; /* integer arguments %[diouxX] */
- short base; /* base for [diouxX] conversion */
- short dprec; /* decimal precision in [diouxX] */
- --- 149,158 ----
- register int cnt; /* return value accumulator */
- register int n; /* random handy integer */
- register char *t; /* buffer pointer */
- ! #ifdef __FLOATS__
- ! /* double _double; *//* double precision arguments %[eEfgG] */
- ! union double_di _dd; /* _double is #defined to be _dd later on */
- ! #endif __FLOATS__
- u_long _ulong; /* integer arguments %[diouxX] */
- short base; /* base for [diouxX] conversion */
- short dprec; /* decimal precision in [diouxX] */
- ***************
- *** 247,253 ****
- --- 272,286 ----
- case 'f':
- case 'g':
- case 'G':
- +
- + /* mjr: check for NANs */
- + #define _double _dd.d
- _double = va_arg(argp, double);
- + if( (unsigned long)_dd.i[0] == __notanumber[0]) {
- + t = strcpy(t, " Not A Number ");
- + size = strlen(t);
- + goto pforw;
- + }
- /*
- * don't do unrealistic precision; just pad it with
- * zeroes later, so buffer size stays rational.
- ***************
- *** 269,274 ****
- --- 302,320 ----
- }
- else
- softsign = 0;
- + /* mjr: check for +-INFINITY */
- + if(
- + ((unsigned long)_dd.i[0] == __p_infinity[0])
- + /* && ((unsigned long)_dd.i[1] == __p_infinity[1]) */
- + /* mjr: don't test this in order to catch a conversion bug in gcc-as */
- + ) {
- + if(softsign == 0)
- + t = strcpy(t, " Infinity ");
- + else
- + t = strcpy(t, " -Infinity ");
- + size = strlen(t);
- + goto pforw;
- + }
- /*
- * cvt may have to round up past the "start" of the
- * buffer, i.e. ``intf("%.2f", (double)9.999);'';
- ***************
- *** 321,327 ****
- #ifdef __GNUC__
- char *p;
- void *memchr(const void *, int, size_t);
- -
- #else
- char *p, *memchr();
- #endif
- --- 367,372 ----
- *** 1.8 1991/12/26 15:53:59
- --- fdopen.c 1992/02/04 17:16:08
- ***************
- *** 3,11 ****
- #include <stdio.h>
- #include <fcntl.h>
- #include <unistd.h>
-
- - extern FILE _iob[];
- -
- FILE *fdopen(h, mode)
- register int h;
- const register char *mode;
- --- 3,10 ----
- #include <stdio.h>
- #include <fcntl.h>
- #include <unistd.h>
- + #include <errno.h>
-
- FILE *fdopen(h, mode)
- register int h;
- const register char *mode;
- ***************
- *** 19,25 ****
- if(!(_iob[i]._flag & (_IORW | _IOREAD | _IOWRT)))
- fp = &_iob[i]; /* empty slot */
- if(!fp)
- ! return(NULL);
- while(*mode)
- {
- switch(*mode++)
- --- 18,27 ----
- if(!(_iob[i]._flag & (_IORW | _IOREAD | _IOWRT)))
- fp = &_iob[i]; /* empty slot */
- if(!fp)
- ! {
- ! errno = EMFILE;
- ! return(NULL);
- ! }
- while(*mode)
- {
- switch(*mode++)
- *** 1.15 1991/12/26 15:53:59
- --- fopen.c 1992/02/04 17:16:09
- ***************
- *** 4,9 ****
- --- 4,10 ----
- #include <stdlib.h>
- #include <fcntl.h>
- #include <unistd.h>
- + #include <errno.h>
- #ifndef _COMPILER_H
- #include <compiler.h>
- #endif
- ***************
- *** 97,103 ****
- return fp;
- }
- else
- ! return NULL;
- }
-
- /*
- --- 98,107 ----
- return fp;
- }
- else
- ! {
- ! errno = EMFILE;
- ! return NULL;
- ! }
- }
-
- /*
- *** 1.10 1991/04/23 16:04:12
- --- fputc.c 1992/02/04 17:16:10
- ***************
- *** 50,54 ****
- c = '\n';
- goto _fputc;
- }
- ! return(c);
- }
- --- 50,54 ----
- c = '\n';
- goto _fputc;
- }
- ! return(c & 0xff);
- }
- *** 1.8 1991/06/23 17:07:09
- --- fscanf.c 1992/02/04 17:16:11
- ***************
- *** 5,10 ****
- --- 5,14 ----
- #include <compiler.h>
- #endif
-
- + #ifdef sun
- + # define fungetc ungetc
- + #endif
- +
- __EXTERN int _scanf __PROTO((FILE *fp, int (*get)(FILE *f),
- int (*unget)(int c, FILE *s),
- const char *fmt, va_list argp));
- *** 1.8 1991/05/23 14:43:17
- --- getpw.c 1992/02/04 17:16:13
- ***************
- *** 30,35 ****
- --- 30,36 ----
- */
-
- #include <stdio.h>
- + #include <types.h>
- #include <pwd.h>
- #include <unistd.h>
- #include <support.h>
- ***************
- *** 90,97 ****
- return (& curentry);
- }
-
- struct passwd *getpwuid (uid)
- ! register int uid;
- {
- if (! setpwent ())
- return (NULL);
- --- 91,102 ----
- return (& curentry);
- }
-
- + #if __STDC__
- + struct passwd *getpwuid (uid_t uid)
- + #else
- struct passwd *getpwuid (uid)
- ! uid_t uid;
- ! #endif
- {
- if (! setpwent ())
- return (NULL);
- ***************
- *** 104,110 ****
- }
-
- struct passwd *getpwnam (name)
- ! register char *name;
- {
- if (! setpwent ())
- return (NULL);
- --- 109,115 ----
- }
-
- struct passwd *getpwnam (name)
- ! register const char *name;
- {
- if (! setpwent ())
- return (NULL);
- *** 1.12 1991/12/26 15:53:59
- --- localtim.c 1992/02/04 17:16:17
- ***************
- *** 152,157 ****
- --- 152,158 ----
-
- tzset();
- offset = *t - _timezone;
- + if(offset < 0) offset = 0; /* this is questionable */
- stm = _gmtime(&offset, <im);
- if (stm == NULL) return stm; /* check for illegal time */
- stm->tm_isdst = (dst == -1) ? -1 : 0;
- *** 1.20 1991/12/26 15:53:59
- --- main.c 1992/02/04 17:16:17
- ***************
- *** 116,123 ****
- _getbuf(f); /* get a buffer */
- }
-
- ! for(i = 0; i <= __OPEN_INDEX(2); i++) {
- ! __open_stat[i].filename = isatty(i) ?
- ((_console_dev == 2) ? "/dev/console" : "/dev/tty1")
- : (char *)NULL; /* if it was re-dir */
- }
- --- 116,123 ----
- _getbuf(f); /* get a buffer */
- }
-
- ! for(i = 0; i <= 2; i++) {
- ! __open_stat[__OPEN_INDEX(i)].filename = isatty(i) ?
- ((_console_dev == 2) ? "/dev/console" : "/dev/tty1")
- : (char *)NULL; /* if it was re-dir */
- }
- *** 1.18 1991/12/26 15:53:59
- --- malloc.c 1992/02/04 17:16:18
- ***************
- *** 76,85 ****
- if (((long)q) == -1) /* can't alloc any more? */
- return(NULL);
-
- ! p->next = q;
- q->size = sz;
- ! q->next = NULL;
- q->valid = VAL_FREE;
- }
-
- if (q->size > n + sizeof(struct mem_chunk))
- --- 76,89 ----
- if (((long)q) == -1) /* can't alloc any more? */
- return(NULL);
-
- ! /* Note: q may be below the highest allocated chunk */
- ! p = &_mchunk_free_list;
- ! while (p->next != NULL && q > p->next)
- ! p = p->next;
- q->size = sz;
- ! q->next = p->next;
- q->valid = VAL_FREE;
- + p->next = q;
- }
-
- if (q->size > n + sizeof(struct mem_chunk))
- ***************
- *** 157,177 ****
- r->size = 0;
- r->next = NULL;
- s = (struct mem_chunk * )(((long) p) + p->size);
- ! if ((!_split_mem) && _heapbase != NULL && s >= (struct mem_chunk *) _heapbase) {
- assert(s == _heapbase);
- _heapbase = (char *) p;
- _stksize += p->size;
- ! o->next = NULL; /* o is always != NULL here */
- }
- }
- else
- {
- s = (struct mem_chunk * )(((long) r) + r->size);
- ! if ((!_split_mem) && _heapbase != NULL && s >= (struct mem_chunk *) _heapbase) {
- assert(s == _heapbase);
- _heapbase = (char *) r;
- _stksize += r->size;
- ! p->next = NULL;
- } else p->next = r;
- }
- }
- --- 161,185 ----
- r->size = 0;
- r->next = NULL;
- s = (struct mem_chunk * )(((long) p) + p->size);
- ! if ((!_split_mem) && _heapbase != NULL &&
- ! s >= (struct mem_chunk *) _heapbase &&
- ! s < (struct mem_chunk *) (_heapbase + _stksize)) {
- assert(s == _heapbase);
- _heapbase = (char *) p;
- _stksize += p->size;
- ! o->next = p->next; /* o is always != NULL here */
- }
- }
- else
- {
- s = (struct mem_chunk * )(((long) r) + r->size);
- ! if ((!_split_mem) && _heapbase != NULL &&
- ! s >= (struct mem_chunk *) _heapbase &&
- ! s < (struct mem_chunk *) (_heapbase + _stksize)) {
- assert(s == _heapbase);
- _heapbase = (char *) r;
- _stksize += r->size;
- ! p->next = r->next;
- } else p->next = r;
- }
- }
- *** 1.14 1992/01/14 18:46:50
- --- mincl 1992/02/04 17:16:19
- ***************
- *** 79,93 ****
- $(CC) $(CFFLAGS) -c fork.c
-
- #
- ! # setjmp, div, _normdf, ldexp, frexp must be pre-processed
- %.s : %.cpp
- $(CPP) $(PPFLAGS) $< $@
-
- setjmp.o : setjmp.cpp
- div.o : div.cpp
- ! _normdf.o : _normdf.cpp
- ! ldexp.o : ldexp.cpp
- ! frexp.o : frexp.cpp
-
- #
- # integer only io stuff
- --- 79,107 ----
- $(CC) $(CFFLAGS) -c fork.c
-
- #
- ! # Assembler stuff that needs to be preprocessed by cpp into a .S
- ! #
- %.s : %.cpp
- $(CPP) $(PPFLAGS) $< $@
-
- setjmp.o : setjmp.cpp
- div.o : div.cpp
- ! _addsubd.o: _addsubd.cpp
- ! _addsubs.o: _addsubs.cpp
- ! _divdf3.o: _divdf3.cpp
- ! _divsf3.o: _divsf3.cpp
- ! _extends.o: _extends.cpp
- ! _fixdfsi.o: _fixdfsi.cpp
- ! _floatsi.o: _floatsi.cpp
- ! _fxunsd.o: _fxunsd.cpp
- ! _muldf3.o: _muldf3.cpp
- ! _mulsf3.o: _mulsf3.cpp
- ! _normdf.o: _normdf.cpp
- ! _normsf.o: _normsf.cpp
- ! _truncdf.o: _truncdf.cpp
- ! frexp.o: frexp.cpp
- ! ldexp.o: ldexp.cpp
- ! modf.o: modf.cpp
-
- #
- # integer only io stuff
- ***************
- *** 103,109 ****
-
- # other dependencies
- bcopy.o : bcopy.s
- - modf.o : modf.s
- atof.o : flonum.h
-
- #
- --- 117,122 ----
- ***************
- *** 129,135 ****
- rm -f $(ANSI)
- rm -f $(PORT)
- rm -f $(IIOBJ)
- ! rm -f setjmp.s div.s _normdf.s ldexp.s frexp.s
-
- realclean: clean
- rm -f $(ALL) $(ALL020)
- --- 142,151 ----
- rm -f $(ANSI)
- rm -f $(PORT)
- rm -f $(IIOBJ)
- ! rm -f setjmp.s div.s
- ! rm -f _addsubd.s _addsubs.s _divdf3.s _divsf3.s _extends.s _fixdfsi.s
- ! rm -f _floatsi.s _fxunsd.s _muldf3.s _mulsf3.s _normdf.s _normsf.s
- ! rm -f _truncdf.s frexp.s ldexp.s modf.s
-
- realclean: clean
- rm -f $(ALL) $(ALL020)
- *** 1.2 1991/12/26 15:53:59
- --- pipe.c 1992/02/04 17:16:22
- ***************
- *** 2,14 ****
- #include <stat.h>
- #include <types.h>
- #include <errno.h>
- - #include <stdio.h>
- #include <stdlib.h>
- #define __MINT__
- #include <mintbind.h>
-
- extern int __mint;
-
- /**
- ** (sjk)++ These routines simulate a eunchs pipe() call using temporary
- ** files. A linked list of type *_pipe is kept as to allow as
- --- 2,25 ----
- #include <stat.h>
- #include <types.h>
- #include <errno.h>
- #include <stdlib.h>
- + #include <unistd.h>
- + #include <string.h>
- #define __MINT__
- #include <mintbind.h>
-
- +
- extern int __mint;
-
- + #if defined(DEBUG)
- + # include <stdio.h>
- + #endif
- +
- + #ifndef _COMPILER_H
- + # include <compiler.h>
- + #endif
- + __EXTERN char *tmpnam __PROTO((char *buf));
- +
- /**
- ** (sjk)++ These routines simulate a eunchs pipe() call using temporary
- ** files. A linked list of type *_pipe is kept as to allow as
- ***************
- *** 29,34 ****
- --- 40,48 ----
- static struct _pipe *__pipes = NULL;
- static int del_list (struct _pipe *);
-
- + __EXTERN int pipeclose __PROTO((int fd));
- + extern int (*pipeclose_p) __PROTO((int fd));
- +
- /*---------------------------------------------------------------------------*/
- /* Make a pipe, open the tempory file, set it up for writing, add the pipe */
- /* descriptor to our linked list of pipes, and return. */
- ***************
- *** 35,45 ****
- /*---------------------------------------------------------------------------*/
- int pipe(fildes)
- int fildes[2];
- ! { int fd,ifd;
- char name[40];
- struct _pipe *p;
-
- ! tmpnam(name); /* Make a temporary file name. /*
-
- /*----------------------------------------------*/
- /* Open the pipe for reading and writing. */
- --- 49,59 ----
- /*---------------------------------------------------------------------------*/
- int pipe(fildes)
- int fildes[2];
- ! { int fd;
- char name[40];
- struct _pipe *p;
-
- ! tmpnam(name); /* Make a temporary file name. */
-
- /*----------------------------------------------*/
- /* Open the pipe for reading and writing. */
- ***************
- *** 51,57 ****
- --- 65,75 ----
- #endif
-
- if (fd < 0)
- + #if defined(DEBUG)
- fprintf(stderr,"fd returns : %d! PIPE(%s) failed.\n",fd, name);
- + #else
- + /* nothing */;
- + #endif
- else
- { /*------------------------------------------*/
- /* Get a pipe description block and */
- ***************
- *** 64,69 ****
- --- 82,89 ----
- strcpy(p->p_name,name); /* fill in name. */
- p->flag = 'w'; /* initially for write. */
- p->file_des = fd; /* fill in the pipe descriptor. */
- + if(!__pipes)
- + pipeclose_p = pipeclose; /* patch in addr of close routine */
- /*-------------------------------------------------------------------*/
- p->next = __pipes; /* Link to our list of open pipes. */
- __pipes = p;
- ***************
- *** 70,76 ****
- /*-------------------------------------------------------------------*/
- fildes[0] = fildes[1] = fd; /* we fill in fildes[]. */
- if (__mint)
- ! Fcntl(fd,0L,2); /* Make fd shared across Pexecs() */
- }
- return(fd); /* Return the file descriptor. */
- }
- --- 90,96 ----
- /*-------------------------------------------------------------------*/
- fildes[0] = fildes[1] = fd; /* we fill in fildes[]. */
- if (__mint)
- ! (void) Fcntl(fd,0L,2); /* Make fd shared across Pexecs() */
- }
- return(fd); /* Return the file descriptor. */
- }
- ***************
- *** 84,90 ****
- int
- pipeclose(fd)
- int fd;
- ! { struct _pipe *p,*q = NULL;
- int ifd;
- for (p=__pipes; p; p=p->next)
- { if (fd == p->file_des)
- --- 104,110 ----
- int
- pipeclose(fd)
- int fd;
- ! { struct _pipe *p;
- int ifd;
- for (p=__pipes; p; p=p->next)
- { if (fd == p->file_des)
- ***************
- *** 109,115 ****
- --- 129,137 ----
- }
- }
- }
- + #if defined(DEBUG)
- fprintf(stderr,"attempt to close nonexistant pipe.\n");
- + #endif
- return(-1);
- }
-
- ***************
- *** 136,141 ****
- --- 158,165 ----
- q = r; /* update trailing pointer. */
- }
- }
- + #if defined(DEBUG)
- fprintf(stderr,"Attempt to delete a nonexisting pipe form list (__pipes).");
- + #endif
- return(-1);
- }
- *** 1.8 1991/12/26 15:53:59
- --- sbrk.c 1992/02/04 17:16:24
- ***************
- *** 9,14 ****
- --- 9,20 ----
- unlike Unix.
- */
-
- + /* Further WARNING: in a split_mem model the memory addresses will NOT
- + be monotonous. sigh! (i hate these mem models as much as the next
- + person. as usual, people at atari are totally oblivious to such
- + brain damage, even when pointed out to them. sigh!)
- + */
- +
- #include <osbind.h>
- #include <unistd.h>
- #include <errno.h>
- *** 1.12 1991/12/26 15:53:59
- --- scanf.c 1992/02/04 17:16:25
- ***************
- *** 67,73 ****
- #define inchar() ((c = ((*get)(s))) == EOF ? EOF : (++read_in, c))
- #define unchar(c) (--read_in, (*unget)(c, s))
- #define conv_error() return((c == EOF || ((*unget)(c, s))), done)
- ! #define input_error() return(-1)
- #define memory_error() return((errno = ENOMEM), EOF)
-
-
- --- 67,73 ----
- #define inchar() ((c = ((*get)(s))) == EOF ? EOF : (++read_in, c))
- #define unchar(c) (--read_in, (*unget)(c, s))
- #define conv_error() return((c == EOF || ((*unget)(c, s))), done)
- ! #define input_error() return( done < 1 ? EOF : done )
- #define memory_error() return((errno = ENOMEM), EOF)
-
-
- ***************
- *** 250,263 ****
-
- if (width == -1)
- width = 1;
- !
- ! if (do_assign)
- ! while (inchar() != EOF && width-- > 0)
- *str++ = c;
- ! else
- ! while (inchar() != EOF && width-- > 0)
- ;
- !
- if (do_assign)
- ++done;
-
- --- 250,264 ----
-
- if (width == -1)
- width = 1;
- ! /* mjr: */
- ! if (do_assign) {
- ! do
- *str++ = c;
- ! while (inchar() != EOF && --width > 0);
- ! } else
- ! while (inchar() != EOF && --width > 0)
- ;
- !
- if (do_assign)
- ++done;
-
- *** 1.16 1991/12/26 15:53:59
- --- stat.c 1992/02/04 17:16:28
- ***************
- *** 105,112 ****
- return d;
- }
-
- ! int
- ! stat(_path, st)
- const char *_path;
- struct stat *st;
- {
- --- 105,112 ----
- return d;
- }
-
- ! static int
- ! _stat(_path, st)
- const char *_path;
- struct stat *st;
- {
- ***************
- *** 232,238 ****
- st->st_uid = geteuid(); /* the current user owns every file */
- st->st_gid = getegid();
- st->st_blksize = 1024;
- ! return 0;
- }
-
- #include <fcntl.h>
- --- 232,246 ----
- st->st_uid = geteuid(); /* the current user owns every file */
- st->st_gid = getegid();
- st->st_blksize = 1024;
- ! return nval;
- ! }
- !
- ! int
- ! stat(path, st)
- ! const char *path;
- ! struct stat *st;
- ! {
- ! return _stat(path, st) < 0 ? -1 : 0;
- }
-
- #include <fcntl.h>
- ***************
- *** 336,367 ****
- const char *_path;
- struct stat *st;
- {
- ! char path[FILENAME_MAX];
- ! int n, r, linksiz;
- ! SYMDIR *dir;
- ! SYMENTRY *ent;
-
- /* unx2dos returns _NM_LINK if the last path component was a symbolic link
- * in this case, __link_name and __link_path are set to the name and path
- ! * of the symbolic link file, and __link_to to its contents
- */
- ! n = unx2dos(_path, path);
- ! linksiz = strlen(__link_to);
-
- ! if (n == _NM_LINK && _lAUTO && (dir = _read_symdir(__link_path))) {
- ! ent = _symdir_lookup(dir, __link_name);
- ! assert(ent != 0);
- ! if (ent->flags & SD_AUTO)
- ! n = _NM_OK; /* pretend that it wasn't a link*/
- ! _free_symdir(dir);
- ! }
- !
- ! r = stat(_path, st);
- !
- ! if (n != _NM_LINK || r < 0) /* not a symlink */
- return r;
- ! st->st_size = linksiz;
- ! st->st_blocks = (st->st_size + 1023)/1024;
- ! st->st_mode = ((st->st_mode & ~S_IFMT) | S_IFLNK);
- return 0;
- }
- --- 344,366 ----
- const char *_path;
- struct stat *st;
- {
- ! int r;
-
- /* unx2dos returns _NM_LINK if the last path component was a symbolic link
- * in this case, __link_name and __link_path are set to the name and path
- ! * of the symbolic link file, __link_to to its contents, and __link_flags
- ! * its flags.
- */
- ! r = _stat(_path, st);
-
- ! if (r < 0)
- return r;
- !
- ! if (r == _NM_LINK && !(__link_flags & SD_AUTO))
- ! {
- ! st->st_size = strlen(__link_to);
- ! st->st_blocks = 1;
- ! st->st_mode = ((st->st_mode & ~S_IFMT) | S_IFLNK);
- ! }
- return 0;
- }
- *** 1.12 1991/06/11 23:04:27
- --- system.c 1992/02/04 17:16:33
- ***************
- *** 6,11 ****
- --- 6,15 ----
- * Modified by Allan Pratt to call unx2dos on redirect file names
- * and to call spawnvp() without calling fork() -- why bother?
- *
- + * Modified by Frank Ridderbusch in _parseargs() to handle the case
- + * >'file'. Without the modification, the quotes would end up in the
- + * filename for redirection
- + *
- */
-
- #include <stdio.h>
- ***************
- *** 78,84 ****
- const char *s;
- {
- Argentry *cur, *res;
- ! char buf[FILENAME_MAX];
- char *t, quote;
-
- res = cur = _argalloc("");
- --- 82,88 ----
- const char *s;
- {
- Argentry *cur, *res;
- ! char buf[BUFSIZ];
- char *t, quote;
-
- res = cur = _argalloc("");
- ***************
- *** 95,102 ****
- if (*s) s++; /* skip final quote */
- }
- else {
- ! while (*s && !isspace(*s))
- *t++ = *s++;
- if (*s && ( *(s-1) == '>' || *(s-1) == '<' ))
- goto again;
- }
- --- 99,109 ----
- if (*s) s++; /* skip final quote */
- }
- else {
- ! while (*s && !isspace(*s)) {
- *t++ = *s++;
- + if (isquote(*s))
- + goto again;
- + }
- if (*s && ( *(s-1) == '>' || *(s-1) == '<' ))
- goto again;
- }
- *** 1.20 1991/12/26 15:53:59
- --- unx2dos.c 1992/02/04 17:16:37
- ***************
- *** 305,311 ****
- #define MAXRECURSE 12
-
- char __link_path[FILENAME_MAX], __link_name[_LIB_NAME_MAX],
- ! __link_to[_LIB_NAME_MAX];
- int __link_flags = 0;
-
- static int
- --- 305,311 ----
- #define MAXRECURSE 12
-
- char __link_path[FILENAME_MAX], __link_name[_LIB_NAME_MAX],
- ! __link_to[FILENAME_MAX];
- int __link_flags = 0;
-
- static int
- ***************
- *** 392,400 ****
- while (ent) {
- if (!strcmp(ent->linkname, name)) {
- change = _NM_LINK;
- - /* only set __link_to once */
- - if (!__link_to[0])
- - strcpy(__link_to, ent->linkto);
- #ifdef DEBUG
- printf("...following link (%s)->(%s)\n", name, ent->linkto);
- #endif
- --- 392,397 ----
- ***************
- *** 401,406 ****
- --- 398,404 ----
-
- if (level == 0) {
- strcpy(__link_path, result);
- + strcpy(__link_to, ent->linkto);
- __link_flags = ent->flags;
- }
- /*
- ***************
- *** 503,510 ****
- unx = (unx[6]) ? &unx[7] : &unx[6];
- }
- }
- -
- - __link_to[0]='\0';
-
- change = _canon(path, (char *)unx, dos, 0);
- /*
- --- 501,506 ----
- *** 1.15 1991/07/23 22:06:28
- --- write.c 1992/02/04 17:16:37
- ***************
- *** 103,109 ****
- if (*s == '\r')
- __col_pos = 0;
- else
- ! if (*s >= ' ' && *s < 0177)
- __col_pos++;
- else
- if (*s == '\t')
- --- 103,109 ----
- if (*s == '\r')
- __col_pos = 0;
- else
- ! if (*(unsigned char *)s >= ' ')
- __col_pos++;
- else
- if (*s == '\t')
-